package com.listeningframework.boot.exception;

import org.apache.commons.lang3.StringUtils;

/**
 * 
 * Common Exceptions
 *
 * @author Listening
 * @version $Id: BusinessException.java, v 0.1 2016年5月18日 下午10:57:43 Listening Exp $
 */
public class BusinessException extends Exception {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    /**
     * 错误码
     */
    private String            errorCode;

    /**
     * 错误描述
     */
    private String errorDesc;

    public BusinessException(String errorDesc) {
        this(null, errorDesc, null);
    }

    public BusinessException(String errorDesc, Throwable t) {
        this(null, errorDesc, t);
    }

    public BusinessException(String errorCode, String message) {
        this(errorCode, message, null);
    }

    public BusinessException(String errorCode, String errorDesc, Throwable e) {
        super(errorDesc+"["+(StringUtils.isBlank(errorCode)?"-1":errorCode)+"]", e);
        this.errorCode = errorCode;
        this.errorDesc = errorDesc;
    }

	public String getErrorCode() {
		return errorCode;
	}

	public String getErrorDesc() {
		return errorDesc;
	}

    
}
